package cn.xshi.bpm.service.impl;

import cn.xshi.bpm.service.LcStatusService;
import cn.xshi.common.base.BaseService;
import cn.xshi.bpm.dao.LcStatusDao;
import cn.xshi.bpm.model.LcStatus;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
 * @Desc 流程状态
 * @Author 邓纯杰
 * @CreateTime 2012-12-12 12:12:12
 */
@Service
public class LcStatusServiceImpl extends BaseService implements LcStatusService {

	@Resource
	private LcStatusDao lcStatusDao;

	/**
	* 分页
	* @param condition 
	* @return
	*/
	public List<LcStatus> getLcStatusListByCondition(Map<String,Object> condition){
		try{
			return lcStatusDao.getLcStatusListByCondition(condition);
		} catch (Exception e) {
			throw new RuntimeException(e.getMessage(),e.getCause());
		}
	}

	/**
	* 查询对象
	* @param id
	* @return
	*/
	public LcStatus getLcStatusById(String id){
		try{
			return lcStatusDao.getLcStatusById(id);
		} catch (Exception e) {
			throw new RuntimeException(e.getMessage(),e.getCause());
		}
	}

	/**
	* 添加
	* @param lcStatus
	* @return
	*/
	public int addLcStatus(LcStatus lcStatus){
		int i = 0;
		try {
			lcStatus.setId(toUUID());
			lcStatus.setCreateId(getCurrentAccountId());
			lcStatus.setCreateTime(getDate());
			i = lcStatusDao.addLcStatus(lcStatus);
		} catch (Exception e) {
			throw new RuntimeException(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 修改
	* @param lcStatus
	* @return
	*/
	public int updateLcStatus(LcStatus lcStatus){
		int i = 0;
		try {
			lcStatus.setUpdateId(getCurrentAccountId());
			lcStatus.setUpdateTime(getDate());
			i = lcStatusDao.updateLcStatus(lcStatus);
		} catch (Exception e) {
			throw new RuntimeException(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 删除
	* @param condition 
	* @return
	*/
	public int delLcStatus(Map<String,Object> condition){
		int i = 0;
		try {
			i = lcStatusDao.delLcStatus(condition);
		} catch (Exception e) {
			throw new RuntimeException(e.getMessage(),e.getCause());
		}
		return i;
	}
}
